package com.example.springbootmybatis.mapper;

import com.example.springbootmybatis.entity.*;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookMapper {


//    @Delete("delete  from booktable where bookId  in (21,22,33);")

    public int deleteUserByIDs(List<Integer> ids);

//    public List<BookEntity> getAllBooks();


    //@Select("select * from booktable where bookName=#{bookName} and peice=#{price}")
    public List<BookEntity> getBooksByWhere(BookEntity bookEntity);

   public int getBookNum(BookEntity bookEntity);

    public int updateBookByID(BookEntity bookEntity);

    public   int updateBookAvatar(BookEntity bookEntity);

    public int borrowBook(BorrowBookEntity entity);

    public int BorrowPlusByID(Integer bookId);
    public int returnPlusByID(Integer bookId);

    /**
     * 检查本用户是否已经借了此书还没有归还
     * @param entity
     * @return
     */
    public List<BorrowBookEntity> checkBorrowBookInfoByBorrowInfo(BorrowBookEntity entity);

    public List<BorrowInfo> getBorrowBookInfoByID(Integer uid);


    public List<UserEntity> getBorrowBookInfoByID1(Integer uid);


    public int returningBook(BorrowBookEntity entity);

    public int renewBook(BorrowBookEntity entity);


    public int addBook(BookEntity entity);


    public List<BookTypeEntity> getBookTypes();
}
